import Vue from 'vue';
import axios from './router/axios';
import VueAxios from 'vue-axios';
import App from './App';
import * as cordova from './cordova/';
import './permission'; // 权限
import './errorLog'; // 错误日志
import router from './router/router';
import store from './store';
import rem from './util/rem';
import Vant from 'vant';
import 'mint-ui/lib/style.css';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import {
    Lazyload,
    Icon,
} from 'vant';
import 'vant/lib/vant-css/index.css';
import {
    loadStyle,
} from './util/util';
import * as urls from '@/config/env';
import {
    iconfontUrl,
    iconfontVersion,
} from '@/config/env';
import * as filters from './filters'; // 全局filter
import './styles/common.scss';

Vue.use(Vant);

Vue.use(Icon);
Vue.use(ElementUI);
Vue.use(Lazyload);
Vue.use(VueAxios, axios);

Object.keys(urls).forEach((key) => {
    Vue.prototype[key] = urls[key];
});

Object.keys(filters).forEach((key) => {
    Vue.filter(key, filters[key]);
});

iconfontVersion.forEach((ele) => {
    loadStyle(iconfontUrl.replace('$key', ele));
});

Vue.config.productionTip = false;


new Vue({
    router,
    store,
    render: h => h(App),
}).$mount('#app');